<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-classes-edit" th:object="${classes}">
            <div class="form-group">	
                <label class="col-sm-3 control-label">班级编号：</label>
                <div class="col-sm-8">
                    <input id="classNumber" name="classNumber" readonly="readonly" th:field="*{classNumber}" class="form-control required" type="text">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">年级：</label>
                <div class="col-sm-8">
                	<select id="gradeNumber" name="gradeNumber" class="form-control m-b" >
						<option th:each="grade:${listGrade}" th:value="${grade.gradeNumber}" th:text="${grade.name}" th:field="*{gradeNumber}"></option>
					</select>
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">班级名称：</label>
                <div class="col-sm-8">
                    <input id="name" name="name" th:field="*{name}" class="form-control required" type="text">
                </div>
            </div>
            <div class="form-group">	
                <label class="col-sm-3 control-label">入学年份：</label>
                <div class="col-sm-8">
                    <input id="joinYear" name="joinYear" th:field="*{joinYear}" class="form-control required" type="text">
                </div>
            </div>
            <div class="form-group">	
				<label class="col-sm-3 control-label">班主任：</label>
				<div class="col-sm-8">
					<select id="headmasterId" name="headmasterId" class="form-control m-b required" >
						<option th:each="grade:${listTeacher}" th:value="${grade.teacherNumber}" th:text="${grade.name}" th:field="*{headmasterId}"></option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<div class="form-control-static col-sm-offset-9">
					<button type="submit" class="btn btn-primary">提交</button>
					<button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
				</div>
			</div>
		</form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "module/classes"
		$("#form-classes-edit").validate({
			rules:{
				xxxx:{
					required:true,
				},
				name:{
        			maxlength: 10
        		},
        		joinYear:{
        			maxlength: 4,
        			digits: true
        		}
			},
			submitHandler: function(form) {
				$.operate.save(prefix + "/save", $('#form-classes-edit').serialize());
			}
		});
	</script>
</body>
</html>
